home *** CD-ROM | disk | FTP | other *** search
- /*-----------------------------------------------------------------------------
- - File Name:
- - Insert PayPal View Cart.js
- -
- - Description:
- - Functions for View Cart wizard.
- -
- - This file contains proprietary and confidential information from WebAssist.com
- - corporation. Any unauthorized reuse, reproduction, or modification without
- - the prior written consent of WebAssist.com is strictly prohibited.
- -
- - Copyright 2001 WebAssist.com Corporation. All rights reserved.
- ------------------------------------------------------------------------------*/
- var CURRENTPAGE=0;
-
- function commandButtons() {
- return new Array();
- }
-
- /* Initialize the UI. First thing that's called on the body load event. */
- function initializeUI() {
- if (navigator.platform.toLowerCase().indexOf("mac") >= 0) {
-
- document.cancel.style = "position:absolute; width:70px; height:20px; z-index:90; left: 245px; top: 397px; visibility: visible";
- document.cancel.document.btnCancel.style = "width:63; height:20; font-family:'Lucidia Grande'; font-size: 13px";
-
- document.help.style = "position:absolute; width:70px; height:20px; z-index:90; left: 175px; top: 397px; visibility: visible";
- document.help.document.btnHelp.style = "width:63; height:20; font-family:'Lucidia Grande'; font-size: 13px";
-
- document.next.style = "position:absolute; width:70px; height:20px; z-index:90; left: 385px; top: 397px; visibility: visible";
- document.next.document.btnNext.style = "width:63; height:20; font-family:'Lucidia Grande'; font-size: 13px";
-
- document.back.style = "position:absolute; width:70px; height:20px; z-index:90; left: 315px; top: 397px; visibility: visible";
- document.back.document.btnBack.style = "width:63; height:20; font-family:'Lucidia Grande'; font-size: 13px";
-
- document.finish.style = "position:absolute; width:70px; height:20px; z-index:90; left: 385px; top: 397px; visibility: visible";
- document.finish.document.btnFinish.style = "width:63; height:20; font-family:'Lucidia Grande'; font-size: 13px";
-
- document.walogo.top = 402;
- document.pplogo.top = 403;
- }
- document.back.visibility = "visible";
- document.next.visibility = "visible";
- document.help.visibility = "visible";
- document.cancel.visibility = "visible";
- var theDOM = dreamweaver.getDocumentDOM();
- var theParent = theDOM.getSelectedNode();
- var inForm = false;
- while (theParent.parentNode) {
- theParent = theParent.parentNode;
- if (theParent.tagName=="FORM") {
- inForm = theParent;
- break;
- }
- }
- if (inForm) {
- if (inForm.innerHTML.search(/<input type="[^"]*"[^>]*\sname="cmd"[^>]*>/i)>=0)
- {
- alert(MSG_AlreadyPayPalInForm);
- window.close();
- }
- }
- MM.setBusyCursor();
- showPageNum(0);
-
- getLastUID();
- enableDisableOtherImage("VC");
-
- MM.clearBusyCursor();
- }
-
- /******************************** support functions ******************/
- function buildSummaryText() {
- var retVal = "";
- var myImage = findObject("vcimage");
- var myID = findObject("ppUID");
-
- retVal += "PayPal Account: " + myID.value;
- retVal += "\n";
- retVal += "Button Image URL: ";
- for (var n=0; n<myImage.length; n++)
- {
- if (myImage[n].checked)
- {
- if (myImage[n].value == "other")
- {
- retVal += findObject("othervcimage").value;
- }
- else
- {
- retVal += "http://images.paypal.com/images/" + myImage[n].value;
- }
- }
- }
- return retVal;
- }
-
- function openBrowseImageWindow() {
- var browseURL = "";
- var LABEL_Select = "Select View Cart Image..."; // label for file window
- browseURL = dreamweaver.browseForFileURL("select",LABEL_Select, false, true); // opens file window and returns file string as URL
- if (browseURL)
- {
- //browseURL = WA_absoluteToRelativeURL(browseURL, docpath, false);
- findObject("othervcimage").value = browseURL; //set the DataSource
- }
- findObject("othervcimage").focus();
- }
-
- /****************************** page functions ****************************/
- function Pg0_load()
- {
- document.UserIDWP.visibility = "visible";
- findObject("btnBack").setAttribute("disabled", "disabled"); // disable the back button
- findObject("next").visibility = "visible"; // enable next button
- findObject("finish").visibility = "hidden"; // hide finish button
-
- // Set focus but this only seems to work if you delay the page loading by some amount of time (in msec)
- setTimeout('findObject("ppUID").focus()',500);
- return true;
- }
-
- function Pg0_unLoad()
- {
- document.UserIDWP.visibility = "hidden";
- return true;
- }
-
- function Pg1_canLoad() {
- var ppError = validatePPUID();
- if (ppError != "")
- {
- alert ("Account " + ppError);
- return false;
- }
- return true;
- }
-
- function Pg1_load()
- {
- document.ButtonImageWP.visibility = "visible";
- findObject("btnBack").setAttribute("disabled", "enabled"); // disable the back button
- findObject("next").visibility = "visible"; // enable next button
- findObject("finish").visibility = "hidden"; // hide finish button
- // Set focus but this only seems to work if you delay the page loading by some amount of time (in msec)
- setTimeout('findObject("vcimage")[0].focus()',500);
- return true;
- }
-
- function Pg1_unLoad()
- {
- document.ButtonImageWP.visibility = "hidden";
- return true;
- }
-
- function Pg2_canLoad()
- {
- return true;
- }
-
- function Pg2_load()
- {
- document.SummaryWP.visibility = "visible";
- findObject("btnBack").setAttribute("disabled", "enabled"); // disable the back button
- findObject("next").visibility = "hidden"; // enable next button
- findObject("finish").visibility = "visible"; // show finish button
-
- findObject("summaryText").value = buildSummaryText();
- return true;
- }
-
- function Pg2_unLoad()
- {
- document.SummaryWP.visibility = "hidden";
- return true;
- }
-
- function showNextPage() {
- var nextPage = CURRENTPAGE + 1;
- if (eval("Pg"+nextPage+"_canLoad()"))
- {
- eval("Pg"+CURRENTPAGE+"_unLoad()");
- CURRENTPAGE++;
- eval("Pg"+CURRENTPAGE+"_load()");
- }
- }
-
- function showPreviousPage() {
- eval("Pg"+CURRENTPAGE+"_unLoad()");
- CURRENTPAGE--;
- eval("Pg"+CURRENTPAGE+"_load()");
- }
-
- function showPageNum(pageNum) {
- eval("Pg"+CURRENTPAGE+"_unLoad()");
- CURRENTPAGE = pageNum;
- eval("Pg"+CURRENTPAGE+"_load()");
- }